<#macro layout>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>智能化交易平台</title>
<link rel="stylesheet" type="text/css"
	href="/css/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="/css/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="/css/demo.css" />
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<script type="text/javascript">

	function openLoginWindow() {
		$('#login_win').window('open');
	}
	
	function register() {
		$('#reg_form').form('clear');
		$('#login_win').window('close');
		$('#register_win').window('open');
	}
	
	function submitFormById(formId) {
		$('#' + formId).submit();
	}
	
	$(function(){
		//初始化注册表单
		$('#reg_form').form({
			type:'post',
			url:'/user/save',
			success:function(data) {
				var data = eval('(' + data + ')');
				console.log(data);
				if(!data.success) {
					for(var field in data) {
						$('#' + field).text(data[field]);
					}
					return;
				}
				$('#register_win').window('close');//关闭注册窗口
				$('#login_win').window('open');//打开登陆窗口
			}
		});
		
		//初始化登陆表单
		$('#login_form').form({
			url:'/user/login',
			success:function(data) {
				var data = eval('(' + data + ')');
				console.log(data);
				if(!data.success) {
					for(var field in data) {
						$('#' + field).text(data[field]);
					}
					return;
				}
				$.messager.alert('提示','登陆成功,你可以继续你的操作了!');
				$('#login_win').window('close');//打开登陆窗口
			}
		});
		
		//注册自动登陆按钮
		$('#autoLogin').switchbutton({
			checked:true,
			onText:'是',
			offText:'否',
			onChange:function(checked) {
				$('input[name="autoLogin"]').val(checked);
			}
		});
		
		$('#reg_form').form('clear');		
		$('#login_form').form('clear');
	});
</script>
<#-- base href="${CPATH}" / -->
</head>
<body style="padding: 10px">
	<div class="easyui-layout" style="width: 100%; height: 800px;">
		<div
			data-options="region:'west',split:true,collapsed:true,
                hideExpandTool: true,
                expandMode: null,
                hideCollapsedContent: false,
                collapsedSize: 68,
                collapsedContent: function(){
                    return $('#titlebar');
                }
                "
			title="West" style="width: 100px;"></div>
		<div data-options="region:'center',title:'主界面'"><#nested></div>
	</div>
	<div id="titlebar" style="padding: 2px">
		<a href="/quartz" class="easyui-linkbutton" style="width: 100%"
			data-options="iconCls:'icon-large-picture',size:'large',iconAlign:'top'">定时任务</a>
		<a href="/stocksignal" class="easyui-linkbutton" style="width: 100%"
			data-options="iconCls:'icon-large-chart',size:'large',iconAlign:'top'">交易信号</a>
		<a href="/optional" class="easyui-linkbutton" style="width: 100%"
			data-options="iconCls:'icon-large-user',size:'large',iconAlign:'top'">自选信号</a>
		<a href="javascript:void(0)" class="easyui-linkbutton"
			style="width: 100%"
			data-options="iconCls:'icon-large-recommend',size:'large',iconAlign:'top'">推荐信号</a>
	</div>

	<!-- 登陆界面 -->
	<div id="login_win" class="easyui-window" title="用户登陆"
		style="width: 480px; height: 220px"
		data-options="iconCls:'icon-user',modal:true,closed:true">
		<div style="padding: 10px 60px 20px 60px">
			<form id="login_form" method="post">
				<table cellpadding="5">
					<tr>
						<td>用户名:</td>
						<td><input class="easyui-textbox" name="user.username" data-options="iconCls:'icon-man'" style="width:220px"/></td>
					</tr>
					<tr>
						<td>密码:</td>
						<td><input class="easyui-textbox" name="user.password" data-options="iconCls:'icon-lock'" style="width:220px" type="password"/></td>
					</tr>
					<tr>
						<td>自动登陆:</td>
						<td><input id="autoLogin"/></td>
					</tr>
				</table>
				<input name="autoLogin" type="hidden" value="true"/>
				<input name="url" type="hidden" value="true"/>
			</form>
			<div style="text-align: center; padding: 5px">
				<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitFormById('login_form')">登陆</a> 
				<a href="javascript:void(0)" class="easyui-linkbutton" onclick="register()">注册</a>
			</div>
		</div>
	</div>
	<!-- 注册界面 -->
	<div id="register_win" class="easyui-window" title="用户注册"
		style="width: 600px; height: 320px"
		data-options="iconCls:'icon-user',modal:true,closed:true">
		<div style="padding: 10px 60px 20px 60px">
			<form id="reg_form" method="post">
				<table cellpadding="5">
					<tr>
						<td>用户名:</td>
						<td><input class="easyui-textbox" name="user.username" data-options="iconCls:'icon-man'" style="width:220px"/></td>
						<td><label id="regmsg_username" style="color: red"></label></td>
					</tr>
					<tr>
						<td>密码:</td>
						<td><input class="easyui-textbox" name="user.password" data-options="iconCls:'icon-lock'" type="password" style="width:220px"/></td>
						<td><label id="regmsg_password" style="color: red"></label></td>
					</tr>
					<tr>
						<td>密码确认:</td>
						<td><input class="easyui-textbox" name="reg.password2" data-options="iconCls:'icon-lock'" type="password" style="width:220px"/></td>
					</tr>
					<tr>
						<td>中文名字:</td>
						<td><input class="easyui-textbox" name="user.chineseName" data-options="iconCls:'icon-ok'" style="width:220px"/></td>
					</tr>
				</table>
			</form>
			<div style="text-align: center; padding: 5px">
				<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript: $('#reg_form').submit();">保存</a>
			</div>
		</div>
	</div>
</body>
</html>
</#macro>
